package edu.xmut.kakamusic.viewmodel;


import androidx.lifecycle.LiveData;
import androidx.lifecycle.Transformations;
import androidx.lifecycle.ViewModel;

import com.github.leonardoxh.livedatacalladapter.Resource;


import java.util.List;

import edu.xmut.kakamusic.bean.entity.News;
import edu.xmut.kakamusic.utils.RequestUtils;

public class HomeViewModel extends ViewModel {
    public LiveData<List<News>> getNewsList() {
        return Transformations.map(RequestUtils.getInstance().getNewsList(), Resource::getResource);
    }

    public LiveData<List<News>> getAdList() {
        return Transformations.map(RequestUtils.getInstance().getAdList(), Resource::getResource);
    }

}
